﻿using Common;
using Network.UpdateData;
using System.Net.Sockets;

namespace SFJDService.SocketHandle
{
    /// <summary>
    /// 非管理员用户收到消息后再UsersData.xml文件里添加数据
    /// </summary>
    class PH04AddUserOridary : PacketHandle
    {
        public PH04AddUserOridary(Socket socket, Packet packet) : base(socket, packet) { }

        protected override void Handle()
        {
            ClassConfig config = new ClassConfig();
            config.DecodingFromString(Message);
            Runtime.xmlUsers.AddUser(config);
            Runtime.users.Add(config);
            if (Runtime.thisUser.UserGuid == config.UserGuid)
            {
                Runtime.xmlConfig.SetConfig(config);
                Runtime.thisUser.Copy(config);
            }
        }
    }
}
